package shixhun;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Demo6 {
    public static void main(String[] args) throws ParseException {
        Date data = new Date();
        System.out.println(data);
        System.out.println(data.getTime());
        String datastr = "2022-12-27";
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd");
        Date date1 = sdf.parse(datastr);
        System.out.println(date1);
        SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-mm-dd HH:MM:SS");
     String datastr1 = sdf2.format(data);
        System.out.println(datastr1);
    }
}
